1. Field of the Invention
This invention relates in general to the field of microprocessors, and more particularly to a method and apparatus for converting and transferring data between floating point and integer registers within the context of calculating RGB values for graphic points.
2. Description of the Related Art
In general, modern computer systems treat numerical data as either integer data or floating point data depending on the application, the size of the number required by the application, and the type of operation to be performed on the data. Because of the difference in data formats between integer data and floating point data, microprocessors typically have two separate processing units, one for processing integer data (the Integer Unit, or IU), the other for processing floating point data (the Floating Point Unit, or FPU). Integer data is operated on by the integer unit within a microprocessor, while floating point data is operated on by the floating point unit within a microprocessor.
Frequently, data is shared by both an integer unit and a floating point unit. When data is shared, it must first be converted into an acceptable form, depending on whether it will be operated upon by the integer unit or the floating point unit. Conversion of data into an acceptable form is typically accomplished as a single operation that converts the data, from integer to floating point, or from floating point to integer, and then stores the converted data into memory.
Thus, before an integer unit can operate on data that is in a floating point unit, the data must first be converted into integer format, and then stored to memory. Alternatively, before a floating point unit can operate on data that is in an integer unit, the data must first be converted into floating point format, and then stored to memory. In modern microprocessors, requiring data to be converted, stored to memory, and then retrieved from memory, is very time consuming for the microprocessor, and adds significant delay in processing the data.
One context in which this is particularly true is in the processing of graphical points to be presented on a computer display. At present, every graphical point on a computer display has various attributes that must be calculated, many times each second. Among these attributes are the relative intensities of Red, Blue and Green (RGB). Typically, each attribute exists as a floating point number in the range of 0-1, signifying intensity of the RGB attribute. However, before the attribute is used to display a graphical point, it is multiplied by 256, and then converted into an integer. The integer, in the range of 0-255, is then provided to a video controller for display. Thus, for each attribute of each graphical point, a floating point multiply is required, followed by a conversion of the product into an integer, storage of the integer to memory, and subsequent loading of the integer into the integer unit of the microprocessor. The floating point multiply, followed by the integer conversion for each graphic point is very time consuming for the microprocessor.
Therefore, what is needed is an apparatus and method that unifies the floating point multiply, and the subsequent integer conversion, into a single operation, and that performs that operation faster than has heretofore been possible.